package com.wgj.android.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;

import com.wgj.android.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2018/3/14.
 */

public class SelectVideoDialog extends Dialog {
    @BindView(R.id.bt_take_video)
    Button btTakePicture;
    @BindView(R.id.bt_choose_video)
    Button btChoosePicture;
    @BindView(R.id.bt_cancel)
    Button btCancel;
    private OnTakeVideosListener onTakeVideosListener;
    public SelectVideoDialog(@NonNull Context context) {
        super(context);
    }

    public SelectVideoDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
    }

    protected SelectVideoDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_takevideos);
        ButterKnife.bind(this);
        setCanceledOnTouchOutside(true);//dialog弹出后会点击屏幕，dialog不消失；点击物理返回键dialog消失

        getWindow().setGravity(Gravity.BOTTOM);
        getWindow().setWindowAnimations(R.style.dialog_animation);
    }
    @OnClick({R.id.bt_take_video,R.id.bt_choose_video,R.id.bt_cancel})
    public void onClick(View v){
        switch (v.getId()){
            case R.id.bt_take_video:
                onTakeVideosListener.onTakeVideosClick();
                dismiss();
                break;
            case R.id.bt_choose_video:
                onTakeVideosListener.onChooseVideosClick();
                dismiss();
                break;
            case R.id.bt_cancel:
                dismiss();
                break;
        }
    }
    public SelectVideoDialog  setSelectVideosListener(OnTakeVideosListener onTakeVideosListener) {
        this.onTakeVideosListener = onTakeVideosListener;
        return this;
    }

    public interface OnTakeVideosListener {

        public void onTakeVideosClick();

        public void onChooseVideosClick();
    }
}
